## From Shi Huang
require(rms)
require(survival)
d <- data.frame(tstart=c(0 ,1083, 0 , 428, 0,18, 0 , 583, 0, 1702, 0,  923, 0,31, 0 , 664, 0,49, 0,  180, 0, 1, 0 , 202, 0, 41, 0,14, 0,44, 0,93, 0,36, 0,11, 0,24, 0,35, 0, 1296, 0,  486, 0,41, 0,97, 0 , 903, 0,20, 0,  811, 0 , 624, 0, 4, 0 ,1011, 0,51, 0, 1703, 0, 1987, 0, 1700, 0,38, 0,90, 0,21, 0,219),
tstop=c(1083 ,1519,  428 , 681,18,22, 583, 2452 ,1702 ,1816 , 923 ,1386,31 , 247 , 664 , 675,49,55 , 180 , 190, 1 , 239 , 202 , 276,41, 83,14,  131,44,85,93 , 233,36 , 524,11,60,24,34,35,41 ,1296 ,1360 , 486 , 564,41, 1043,97 , 412 , 903, 1323, 20,33 , 811 ,1504 , 624 , 791, 4 , 116, 1011 ,1789,51 ,1649 ,1703 ,1727 ,1987,2009 ,1700 ,1758,38,79,90 , 119,21,40 , 219 ,538),
event=c(0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1),
tx=c(0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1))

S <- with(d, Surv(tstart, tstop, event))

f <- coxph(S ~ tx,  data=d)

g <- cph(S ~ tx, data=d, eps=1e-9, iter.max=25)

c(coef(f), coef(g), sqrt(diag(vcov(f))), sqrt(diag(vcov(g))))
